package inner;

import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author oldliu
 * @since 1.0
 */
public class TestServer {
    public static void main(String[] args) throws Exception {
        ServerSocket st = new ServerSocket(9999);
        ExecutorService executors = Executors.newFixedThreadPool(20);
        System.out.println("服务器启动！");
        while (true) {
            //线程池。。。
            final Socket s=st.accept();
            executors.submit(new Runnable() {
                @Override
                public void run() {
                    Socket socket=s;
                    //...

                }
            });
            //executors.submit(new MyOut(st.accept()));
        }
    }
}
